﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using CommunitySystem.BO.SystemManager;
using CommunitySystemModel;
using System.Data;

namespace CommunitySystem.Web.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "MQService" in code, svc and config file together.
    public class MQService : IMQService
    {
        public void DoWork()
        {
        }

        MQCJManangerBO mqcjBo = new MQCJManangerBO();

        #region IMQService RKXX

        public List<CommunitySystemModel.RKXXViewDb> GetRKXXViewDbByCondition(string nameStr, int xb, string sfz, List<string> mqlx,
            List<string> zylb, string zzmm = "", string judz = "", string rklb = "", string hjdz = "", string xz = "", string whcd = "", DateTime? sDate = null, DateTime? eDate = null)
        {
            return mqcjBo.GetRKXXViewDbByCondition(nameStr, xb, sfz, mqlx, zylb, zzmm, judz, rklb, hjdz, xz, whcd, sDate, eDate);
        }

        public int InsertBAS_RKXXModel(CommunitySystemModel.BAS_RKXXModel rkxxModel, List<CommunitySystemModel.RKXXFamilyMemberActionObj> cuMembers = null)
        {
            return mqcjBo.InsertBAS_RKXXModel(rkxxModel, cuMembers);
        }

        public bool UpdateBAS_RKXXModel(CommunitySystemModel.BAS_RKXXModel rkxxModel, List<CommunitySystemModel.RKXXFamilyMemberActionObj> cuMembers = null)
        {
            return mqcjBo.UpdateBAS_RKXXModel(rkxxModel, cuMembers);
        }

        public CommunitySystemModel.BAS_RKXXModel GetBAS_RKXXModelByID(int id)
        {
            return mqcjBo.GetBAS_RKXXModelByID(id);
        }

        public List<CommunitySystemModel.BAS_RKXXModel> GetRKXXMemberViewDbByFwId(int fwId, int cuRkxxId = 0)
        {
            return mqcjBo.GetRKXXMemberViewDbByFwId(fwId, cuRkxxId);
        }


        public List<CommunitySystemModel.DataDictionaryItemModel> GetDictionaryByParentId(int parentId)
        {
            return mqcjBo.GetDictionaryByParentId(parentId);
        }

        public List<CommunitySystemModel.DataDictionaryItemModel> GetChildDictionaryByDictName(string dictName)
        {
            return mqcjBo.GetChildDictionaryByDictName(dictName);
        }

        #endregion

        #region   居委信息
        public List<CommunitySystemModel.BAS_CJWXXModel> GetBAS_CJWXXModelList(int Id = 0)
        {
            return SYFWManagerBO.GetBAS_CJWXXModelList(Id);
        }

        public int InsertBAS_CJWXXModel(CommunitySystemModel.BAS_CJWXXModel _BAS_CJWXXModel)
        {
            return SYFWManagerBO.InsertBAS_CJWXXModel(_BAS_CJWXXModel);
        }

        public bool UpdateBAS_CJWXXModel(CommunitySystemModel.BAS_CJWXXModel _BAS_CJWXXModel)
        {
            return SYFWManagerBO.UpdateBAS_CJWXXModel(_BAS_CJWXXModel);
        }

        public bool DeleteBAS_CJWXXModelById(int id)
        {
            return SYFWManagerBO.DeleteBAS_CJWXXModelById(id);
        }
        #endregion

        #region 小区
        public List<CommunitySystemModel.BAS_XQXXModel> GeBAS_XQXXModelList(int Id = 0, int jwId = 0)
        {
            return SYFWManagerBO.GeBAS_XQXXModelList(Id, jwId);
        }

        public int InsertBAS_XQXXModel(CommunitySystemModel.BAS_XQXXModel _BAS_XQXXModel)
        {
            return SYFWManagerBO.InsertBAS_XQXXModel(_BAS_XQXXModel);
        }

        public bool UpdateBAS_XQXXModel(CommunitySystemModel.BAS_XQXXModel _BAS_XQXXModel)
        {
            return SYFWManagerBO.UpdateBAS_XQXXModel(_BAS_XQXXModel);
        }

        public bool DeleteBAS_XQXXModelById(int id)
        {
            return SYFWManagerBO.DeleteBAS_XQXXModelById(id);
        }

        #endregion


        #region 房屋
        public bool AddInitHouseInfo(int xqId, int cens, int mds, int mdInits, string msEX, int hus, int huInits, string huEX)
        {
            return SYFWManagerBO.AddInitHouseInfo(xqId,cens,mds,mdInits,msEX,hus,huInits,huEX);
        }

        public List<CommunitySystemModel.BAS_FWXXModel> GetBAS_FWXXModelByXqId(int xqId = 0)
        {
            return SYFWManagerBO.GetBAS_FWXXModelByXqId(xqId);
        }

        public List<CommunitySystemModel.BAS_FWXXModel> GetBAS_FWXXModelByXqIdAndHao(string HaoEx, int xqId = 0, int Hao = 0)
        {
            return SYFWManagerBO.GetBAS_FWXXModelByXqIdAndHao(HaoEx,xqId, Hao);
        }
        public bool AddFWInfo(List<CommunitySystemModel.BAS_FWXXModel> addFW)
        {
            return SYFWManagerBO.AddFWInfo(addFW);
        }
        public bool DeleteFwByFwID(int fwId)
        {
            return SYFWManagerBO.DeleteFwByFwID(fwId);
        }
        public bool UpdateBAS_FWXXModel(CommunitySystemModel.BAS_FWXXModel _BAS_FWXXModel)
        {
            return SYFWManagerBO.UpdateBAS_FWXXModel(_BAS_FWXXModel);
        }
        #endregion

        #region 块区

        public List<SimpleObject<int, string, int,string, bool>> GetXqAndHaoInfo(int kqId = 0,int CJWID=0)
        {
            return SYFWManagerBO.GetXqAndHaoInfo(kqId, CJWID);
        }
        public List<BAS_KQXXModel> GetBAS_KQXXModelList(int Kqid = 0,int CwId=0)
        {
            return SYFWManagerBO.GetBAS_KQXXModelList(Kqid, CwId);
        }

        public bool AddKQInfo(BAS_KQXXModel _BAS_KQXXModel)
        {
            return SYFWManagerBO.AddKQInfo(_BAS_KQXXModel);
        }

        public bool UpdateKQInfo(BAS_KQXXModel _BAS_KQXXModel)
        {
            return SYFWManagerBO.UpdateKQInfo(_BAS_KQXXModel);
        }

        public bool DeleteKQByID(int kqId)
        {
            return SYFWManagerBO.DeleteKQByID(kqId);
        }
        public List<BAS_KQRY> GetBAS_KQRYList(int KQId = 0, int kqRYId = 0)
        {
            return SYFWManagerBO.GetBAS_KQRYList(KQId, kqRYId);
        }

        public bool AddKQRy(BAS_KQRY _BAS_KQRY)
        {
            return SYFWManagerBO.AddKQRy(_BAS_KQRY);
        }

        public bool UpdateKQRy(BAS_KQRY _BAS_KQRY)
        {
            return SYFWManagerBO.UpdateKQRy(_BAS_KQRY);
        }

        public bool DeleteKQRyById(int id)
        {
            return SYFWManagerBO.DeleteKQRyById(id);
        }
        #endregion



        #region 组团服务

        public List<string> GetBAS_RKXXInfo()
        {
            return SYFWManagerBO.GetBAS_RKXXInfo();
        }

        public List<MQ_XQCZModel> GetMQ_XQCZModelByCondition(DateTime? zfStarDate, DateTime? zfEndDate, DateTime? djStarDate, DateTime? djEndDate, string zfdx = "", 
            List<string> lb = null, string djrName = "", string zjhm = "", string jjqks = "", string jzdz = "", int Id = 0)
        {
            return SYFWManagerBO.GetMQ_XQCZModelByCondition(zfStarDate, zfEndDate, djStarDate, djEndDate, zfdx, lb, djrName
                , zjhm, jjqks, jzdz, Id);
        }

        public BAS_RKXXModel GetBAS_RKXXModelBySFZHAndName(string sfzh, string name)
        {
            return SYFWManagerBO.GetBAS_RKXXModelByID(sfzh, name);
        }

        public BAS_KQXXModel GetMQDAKQViewDisposalCondition(int RKId = 0, string sfzh = "", string dshXm = "")
        {
            return SYFWManagerBO.GetMQDAKQViewDisposalCondition(RKId, sfzh, dshXm);
        }

        public int UpdateMQ_XQCZModel(MQ_XQCZModel adis)
        {
            return SYFWManagerBO.UpdateMQ_XQCZModel(adis);
        }

        public int InsertMQ_XQCZModel(MQ_XQCZModel adis)
        {
            return SYFWManagerBO.InsertMQ_XQCZModel(adis);
        }

        public int DeleteMQ_XQCZModelById(int id)
        {
            return SYFWManagerBO.DeleteMQ_XQCZModelById(id);
        }
        #endregion

        #region 统计分析
        StatisticAnalysisBO sabo = new StatisticAnalysisBO();
        /// <summary>
        /// 人口总数
        /// </summary>
        /// <returns></returns>
        public List<AnlysisEntity> GetRKZS()
        {
            List<AnlysisEntity> list = new List<AnlysisEntity>();
           DataSet ds =sabo.GetRKZS();
           foreach (DataRow dr in ds.Tables[0].Rows)
           {
               AnlysisEntity entity = new AnlysisEntity();
               entity.AnlysisName = dr[0].ToString();
               entity.AnlysisCount = double.Parse(dr[1].ToString());
               entity.AnlysisType = "人口总数情况";
               list.Add(entity);
           }
           return list;
        }
        /// <summary>
        /// 年龄分析
        /// </summary>
        /// <returns></returns>
        public List<AnlysisEntity> GetAgeFX()
        {
            List<AnlysisEntity> list = new List<AnlysisEntity>();
            DataSet ds = sabo.GetAgeFX();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                AnlysisEntity entity = new AnlysisEntity();
                entity.AnlysisName = dr[0].ToString();
                entity.AnlysisCount = double.Parse(dr[1].ToString());
                entity.AnlysisType = "人口总数情况";
                list.Add(entity);
            }
            return list;
        }

        #endregion


      
    }
}
